import axios from 'axios'
import { post } from '@/api/http.js'
function resetUserPassword(params) {
  const a = {
    method: 'ResetPassword_Mod',
    userId: window.userId || 1,
    sign: '1',
    currentPage: 0,
    limit: 0,
    datas: {
      NTID: params.NTID,
    },
  }
  return post(a)
}

function getUserInfoById(id) {
  const a = {
    method: 'SysUser_Que',
    userId: window.userId || 1,
    sign: '1',
    currentPage: 0,
    limit: 0,
    datas: {
      NTID: id,
    },
  }
  return post(a)
}

// 用户登录
function userLogin(data) {
  const a = {
    method: 'SysUser_Login',
    userId: window.userId || 1,
    sign: '1',
    currentPage: 0,
    limit: 0,
    datas: data,
  }
  return post(a)
}

// 获取用户登录记录
function getUserLoginDetails(data) {
  const a = {
    method: 'LoginDetails_Que',
    userId: window.userId || 1,
    sign: '1',
    currentPage: data.currentPage || 1,
    limit: data.limit || 20,
    datas: data,
  }
  return post(a)
}
// 获取用户登录summary
function getUserLoginSummaey(data) {
  const a = {
    method: 'LoginSummary_Que',
    userId: window.userId || 1,
    sign: '1',
    currentPage: data.currentPage || 1,
    limit: data.limit || 20,
    datas: data,
  }
  return post(a)
}

// 导出登录文件
function downloadLoginFile(LogType) {
  const a = {
    method: 'DownLoadLoginLog',
    userId: window.userId || 1,
    sign: '1',
    datas: {
      LogType: LogType, // 1:LoginDetails_Que, 2:LoginSummary_Que
    },
  }
  return post(a)
}
// 导出登录文件
function getLogInStatistics(data) {
  const a = {
    method: 'LogIn_Statistics_Que',
    userId: window.userId || 1,
    sign: '1',
    datas: data || {},
  }
  return post(a)
}
export default {
  resetUserPassword,
  getUserInfoById,
  userLogin,
  getUserLoginDetails,
  getUserLoginSummaey,
  downloadLoginFile,
  getLogInStatistics,
}
